package com.example.demo.controller;

import com.example.demo.pojo.gonghui;
import com.example.demo.pojo.lishizhanji;
import com.example.demo.pojo.shenqingren;
import com.example.demo.pojo.user;
import com.example.demo.service.sv.jbgn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Objects;


@Controller
@RequestMapping("/jbgn")
public class jbgncontoller {
    @Autowired
    jbgn jbgn ;
    @RequestMapping("/aa")
    @ResponseBody
    public String denglu(){

        return "aaa" ;
    }

    @RequestMapping("/denglu")
    @ResponseBody
    public String denglu(@RequestParam(value = "zhang") String zhang,@RequestParam(value = "mi") String mi){
     String jieguo="";
        if((Objects.equals(zhang, ""))||(Objects.equals(mi, "")))
            jieguo="请输入账号或密码！";
        else
        jieguo=jbgn.chazm(zhang,mi);
        return jieguo ;
    }
    @RequestMapping("/zhuce")
    @ResponseBody
    public String zhuche(@RequestParam(value = "zhang") String zhang,@RequestParam(value = "mi") String mi,@RequestParam(value = "mi1") String mi1){
         String jieguo="";
        if(Objects.equals(zhang,""))
          jieguo="请输入账号";
         else if ((Objects.equals(mi, ""))||(Objects.equals(mi1, "")))
            jieguo="请将两次密码输入完整！";
        else if (!Objects.equals(mi, mi1)) {
            jieguo="输入的密码不一致！";
        } else
           jieguo= jbgn.zhuce(zhang,mi);
        return jieguo;
    }
    @RequestMapping("/gaimima")
    @ResponseBody
    public String gaimima(@RequestParam("zhang") String zhang,@RequestParam("yuanmi") String jiu,@RequestParam(value = "xinmi") String xin){
            return jbgn.gaimima(zhang,jiu,xin);
    }

    @RequestMapping("/chongzhi")
    @ResponseBody
     public void chongzhi(@RequestParam(value = "zhang") String zhang,@RequestParam(value = "qian") int qian){
         jbgn.chongzhi(zhang,qian);
}
    @RequestMapping("/shanchuzhanghao")
    @ResponseBody
    public void shangchuzhanghao(@RequestParam(value = "zhang") String zhang,@RequestParam(value = "mi") String mi){
     jbgn.delete(zhang,mi);
    }

    @RequestMapping("/paihangbang")
    @ResponseBody
    public List<user> paihangbang(){
        return jbgn.paihangbang();
    }
    @RequestMapping("/suoyougonghui")
    @ResponseBody
    public List<gonghui> suoyougonghui(){
        return jbgn.suoyougonghui();
    }
    @RequestMapping("/jiarugonghui")
    @ResponseBody
    public String jiarugonghui(@RequestParam("zhang") String zhang,@RequestParam("huizhang") String huizhang){
        return jbgn.jiarugonghui(zhang,huizhang);
    }
    @RequestMapping("/wodegonghui")
    @ResponseBody
    public gonghui wodegonghui(@RequestParam("zhang") String zhang){
        return jbgn.wodegonghui(zhang);
    }
    @RequestMapping("/gonghuichengyuan")
    @ResponseBody
    public List<user> gonghuichengyuan(@RequestParam("zhang") String zhang){
        return jbgn.gonghuichengyuan(zhang);
    }

   @RequestMapping("/shenqinliebiao")
    @ResponseBody
    public List<shenqingren> shenqinliebiao(@RequestParam("huizhang") String zhang){

        return jbgn.shenqinliebiao(zhang);
    }
    @RequestMapping("/tongyiruhui")
    @ResponseBody
    public void tongyiruhui(@RequestParam("huizhang") String huizhang,@RequestParam("shenqingren") String shenqingren){

         jbgn.tongyiruhui(huizhang,shenqingren);
        jbgn.jujueruhui(huizhang,shenqingren);
    }
    @RequestMapping("/jujueruhui")
    @ResponseBody
    public void jujueruhui(@RequestParam("huizhang") String huizhang,@RequestParam("shenqingren") String shenqingren){

        jbgn.jujueruhui(huizhang,shenqingren);
    }
    @RequestMapping("/chuangjiangonghui")
    @ResponseBody
    public String chuangjiangonghui(@RequestParam("gonghuiming") String gonghuiming,@RequestParam("jianshu") String jianshu,@RequestParam("huizhang") String huizhang){

        return jbgn.chuangjiangonghui(gonghuiming,jianshu,huizhang);
    }
    @RequestMapping("/jieguo")
    @ResponseBody
    public void jieguo(@RequestParam("jieguo") int jieguo,@RequestParam("zhang") String zhang,@RequestParam("douzi") int douzi){
         jbgn.jieguo(jieguo,zhang,douzi);
    }
    @RequestMapping("/chagerenxinxi")
    @ResponseBody
    public user chagerenxinxi(@RequestParam("zhang") String zhang){
        return jbgn.chagerenxinxi(zhang);
    }
    @RequestMapping("/lishizhanji")
    @ResponseBody
    public List<lishizhanji> lishizhanji(@RequestParam("zhang") String zhang){
        return jbgn.chalishizhanji(zhang);
    }
    @RequestMapping("/duihuan")
    @ResponseBody
    public void duihuan(@RequestParam("zhang") String zhang,@RequestParam("xuhao") int xuhao,@RequestParam("jifen") int jifen)
    {
          jbgn.duihuan(zhang,xuhao,jifen);
    }
    @RequestMapping("/gaitouxiangkuang")
    @ResponseBody
    public void gaitouxiangkuang(@RequestParam("zhang") String zhang,@RequestParam("touxiangkuang") int touxiangkuang){
           jbgn.gaitouxiangkuang(zhang,touxiangkuang);
    }
    @RequestMapping("/gaipaizhuo")
    @ResponseBody
    public void gaipaizhuo(@RequestParam("zhang") String zhang,@RequestParam("paizhuo") int paizhuo){
        jbgn.gaipaizhuo(zhang,paizhuo);
    }
    @RequestMapping("/gaijishiqi")
    @ResponseBody
    public void gaijishiqi(@RequestParam("zhang") String zhang,@RequestParam("jishiqi") int jishiqi ){
        jbgn.gaijishiqi(zhang,jishiqi);
    }
    @RequestMapping("/lingjindou")
    @ResponseBody
    public void lingjindou(@RequestParam("zhang") String zhang,@RequestParam("jindou") int jindou ){
         jbgn.lingjindou(zhang,jindou);
    }
}
